/*
 * ErrorManager.java
 *
 * Created on den 29 april 2007, 20:07
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package grex;

/**
 *
 * @author rik
 */
import java.util.ArrayList;
public class ErrorManager {
    private ArrayList <ErrorHandler> errorHandlers = new ArrayList();
    private static ErrorManager errorManager;
    /** Creates a new instance of ErrorManager */
    private ErrorManager() {        
    }
    public static ErrorManager getInstance(){
        if(errorManager ==null)
            errorManager = new ErrorManager();
        return errorManager;
    }
    
    public void reportError(Exception e){
        for(ErrorHandler eH : errorHandlers){
            eH.onError(e);
        }
    }
    public void addErrorhandler(ErrorHandler e){
        errorHandlers.add(e);
    }
    
}
